<script setup lang="tsx">
import { message } from "@/utils/message";
import { type PlusColumn, PlusDescriptions } from "plus-pro-components";
const prop = defineProps({
  info: {
    default: () => []
  }
});
function handleCellDbClick(row, column, cell) {
  navigator.clipboard.writeText(row.goodsNo);
  message(`复制货物编号成功`, {
    type: "success"
  });
}
//发货单列表
const columns: PlusColumn[] = [
  {
    label: "订单编号",
    prop: "orderNum",
    valueType: "copy"
  },
  {
    label: "货物目的地",
    prop: "goodsDest"
  },
  {
    label: "存储日期",
    prop: "storageDate",
    formatter(value, data) {
      return value + " - " + data.row.storageEndDate;
    }
  },
  {
    label: "存货企业全称",
    prop: "corp.name"
  },
  {
    label: "企业负责人",
    prop: "principal"
  },
  {
    label: "状态",
    prop: "statusFormat"
  },
  {
    label: "创建时间",
    prop: "createdAt"
  },
  {
    label: "货物信息",
    prop: "orderGoods",
    width: 200
  },
  {
    label: "发货备注",
    prop: "remarks"
  }
];
//商品列表
const goodsColumns: TableColumnList = [
  {
    label: "货物名称",
    prop: "goodsName"
  },
  {
    label: "货物编号",
    prop: "goodsNo",
    minWidth: 175
  },
  {
    label: "分类",
    prop: "category"
  },
  {
    label: "库房",
    prop: "warehouseInfo.warehouse.name"
  },
  {
    label: "库位",
    prop: "warehouseInfo.goodsLocation.name"
  },
  {
    label: "价格",
    prop: "goodsCost"
  },
  {
    label: "货物描述",
    prop: "goodsSpec"
  }
];
</script>

<template>
  <div>
    <PlusDescriptions
      title="提货单详情"
      :column="1"
      :columns="columns"
      :data="prop.info[0]"
    >
      <template #plus-desc-orderGoods="{ value }">
        <pure-table
          :data="value"
          :columns="goodsColumns"
          @cell-dblclick="handleCellDbClick"
        />
      </template>
    </PlusDescriptions>
  </div>
</template>
